package com.longge;

import java.util.HashSet;

public class FindIntersectionValues {

    public int[] findIntersectionValues(int[] nums1, int[] nums2) {

        HashSet<Integer> set1 = new HashSet<>();
        HashSet<Integer> set2 = new HashSet<>();
        for (int i : nums1) {
            set1.add(i);
        }
        for (int i : nums2) {
            set2.add(i);
        }
        int one = 0 ,two = 0;
        for (Integer i : nums1) {
            if (set2.contains(i))one++;
        }
        for (Integer i : nums2) {
            if (set1.contains(i))two++;
        }
        return new int[]{one,two};
    }
}
